package com.maxlen.coupon.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.maxlen.coupon.entity.CouponEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 优惠券信息
 *
 * @author MaxLen
 * @email MaxLen@gmail.com
 * @date 2022-10-27 10:43:47
 */
@Mapper
public interface CouponDao extends BaseMapper<CouponEntity> {


    /**
     * 根据 couponIdList 获取所有优惠券，并且只获取不超过结束时间的优惠券
     * @param longList
     * @return
     */
    List<CouponEntity> getByIdList(@Param("couponIdList") List<Long> longList);

    List<CouponEntity> getReceiveCoupon(@Param("type") Integer code, @Param("publish") Integer code1, @Param("date") Date date, @Param("couponIdList") List<Long> couponHistory);

    CouponEntity getMeetNeedCoupon(@Param("couponId") String couponId, @Param("date") Date date);
}
